home *** CD-ROM | disk | FTP | other *** search
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Jamba code template for $$JAMBA_CLASSNAME$$Obj
- * trbmpobj.java
- */
- $$ENDIF
-
- // All Jamba objects are located in the objects package
- package Aimtech.objects;
-
- // Standard Jamba imports
- import java.lang.*;
- import java.awt.*;
- import java.util.*;
- import Aimtech.utils.*;
- import Aimtech.effects.*;
- import Aimtech.smartpage.*;
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Implementation of Jamba $$JAMBA_CLASSNAME$$Obj object
- */
- $$ENDIF
- public class $$JAMBA_CLASSNAME$$Obj extends BitmappedObj implements Runnable
- {
- // This object's thread
- Thread thread = null;
-
- // Used in objStart to check if previously stopped
- private boolean bStopped = false;
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called once, and only once, when object is first loaded. Use
- * to perform one time object initialization
- */
- $$ENDIF
- public void objLoad ()
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- super.objLoad();
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called each time the Jamba page containing the object is displayed. Use
- * to allocate object resources. These resources should be freed in
- * objFlush
- */
- $$ENDIF
- public final void objPrepare()
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- super.objPrepare();
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called each time the Jamba page containing the object is removed from
- * the list of recently accessed Jamba pages. Use to free resources
- * allocated by object.
- */
- $$ENDIF
- public void objFlush()
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- super.objFlush();
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called in response to several events including the object being made
- * visible and the HTML page containing the object being redisplayed.
- */
- $$ENDIF
- public void objStart()
- {
- // If object stopped by objStop(), restart it here
- if (bStopped)
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- // Start this object's thread
- start ();
- bStopped = false;
- }
-
- super.objStart();
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called in response to several events including the object being made
- * not visible and the HTML page containing the object being changed
- * within a web browser such that another HTML page can be displayed.
- * Use to cease any ongoing object activity.
- */
- $$ENDIF
- public void objStop()
- {
- if (!bStopped)
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- // Stop the this object's thread
- stop ();
- bStopped = true;
- }
-
- super.objStop();
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called to check if the object is dirty and needs to be repainted. This
- * is used to minimize drawing of bitmapped objects.
- */
- $$ENDIF
- public synchronized boolean objNeedsPaint ()
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- return (super.objNeedsPaint ());
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called when the object needs to repaint itself. The painting is done
- * to an the offscreen bitmapped used for double-buffering.
- */
- $$ENDIF
- public synchronized void objPaint (Graphics g)
- {
- // Use local Graphics so as not to modify that passed in.
- Graphics drawG = g.create();
-
- // Do common bitmapped object drawing
- super.objPaint(g);
-
- // Clip to the geometry of the object
- drawG.clipRect (geo.x,geo.y,geo.width,geo.height);
-
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- drawG.drawString ("Object Is Alive", geo.x + 10, geo.y + 20);
-
- // Allow local Graphics to be freed
- drawG.dispose();
-
- // No longer need to be repainted
- bNeedsPaint = false;
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called when object properties are set or changed
- */
- $$ENDIF
- public synchronized void objSetProp(String name, String value)
- {
- if (name.equals("property1"))
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- }
-
- else if (name.equals("property2"))
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- }
-
- // Default property handling
- else super.objSetProp(name, value);
-
- // If a runtime property change force an update.
- if (bPrepared)
- objRepaint();
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called to retrieve the current value of an object property.
- */
- $$ENDIF
- public synchronized String objGetProp(String name)
- {
- // If object does not track a property value in member variables or
- // does not modify properties without updating the object's property
- // list, it can simply allow the default property handling to occur
- // and not have a case for it in the following code
- if (name.equals("property1"))
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- }
-
- else if (name.equals("property2"))
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- }
-
- return (super.objGetProp(name));
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called when an object methods has been called within a ToDo list.
- */
- $$ENDIF
- public synchronized boolean objDoMethod(String method, Vector args)
- {
- if (method.equals ("method1"))
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- }
- else if (method.equals ("method2"))
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- }
- else
- {
- return (super.objDoMethod(method, args));
- }
-
- // Force an update
- objRepaint();
-
- // The method was handled
- return (true);
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Called in response to mouse events to determine if the specified point is a
- * hot spot on the object. This can be used by objects to make transparent pieces
- * not active.
- */
- $$ENDIF
- public boolean objIsHotSpot (Point pt)
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
-
- return (true);
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Standard start method used by Jamba objects
- */
- $$ENDIF
- public void start ()
- {
- if (thread == null)
- {
- thread = new Thread (this);
- }
-
- if (!thread.isAlive())
- {
- thread.start();
- }
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Standard stop method used by Jamba objects
- */
- $$ENDIF
- public void stop ()
- {
- if (thread != null)
- {
- Thread tmp = thread;
- thread = null;
- tmp.stop();
- }
- }
-
- $$IF(JAMBA_EXPLCOMMENTS)
- /**
- * Object's run method for it's thread
- */
- $$ENDIF
- public void run ()
- {
- $$IF(JAMBA_TODOCOMMENTS)
- //# TODO - Insert custom code here
- $$ENDIF
- // Must be last line in method
- stop();
- }
- }
-
-